package com.selune.online.ordering.system.project.customer.controller;

import com.selune.online.ordering.system.project.api.base.response.Response;
import com.selune.online.ordering.system.project.api.pojo.goods.dto.GoodsSearchDTO;
import com.selune.online.ordering.system.project.api.pojo.goods.vo.CategoryGoodsVO;
import com.selune.online.ordering.system.project.api.pojo.goods.vo.GoodsDetailVO;
import com.selune.online.ordering.system.project.api.service.customer.ICustomerGoodsService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @author xiaoyp
 * @date 2020/3/24
 * <p>
 * Description:
 */

@RestController
@RequestMapping("/api/v1/ordering/customer/goods")
public class CustomerGoodsController {
	
	@Autowired
	private ICustomerGoodsService iCustomerGoodsService;
	
	@ApiOperation(value = "商品列表", notes = "商品列表")
	@ApiImplicitParam(name = "goodsSearchDTO", value = "商品查询条件DTO", dataType = "GoodsSearchDTO", paramType = "query")
	@GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
	@ResponseBody
	public Response<List<GoodsDetailVO>> listGoods(GoodsSearchDTO goodsSearchDTO) {
		
		return iCustomerGoodsService.listGoods(goodsSearchDTO);
	}
	
	@ApiOperation(value = "前端展示商品列表", notes = "前端展示商品列表")
	@GetMapping(value = "/list/show", produces = MediaType.APPLICATION_JSON_VALUE)
	@ResponseBody
	public Response<List<CategoryGoodsVO>> listCategoryGoods() {
		
		return iCustomerGoodsService.listCategoryGoods();
	}
}
